function queue(tasks)  {
	return tasks.reduce((promises, task) => {
		return promises.then(v => {
			return new Promise((resolve, reject)=> {
				setTimeout(() => {
					console.log(task)
					resolve(task+10);	// fulfilled
				}, 1000)
			})
		})
	}, Promise.resolve())
}

var ret  = queue([1, 2, 3, 4, 5]);
console.log(ret)
ret.then(v => {
	console.log(v)
})